import _thread

import pandas
from pandas import read_csv, DataFrame
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score
from scipy.stats import pearsonr
from sklearn.preprocessing import MinMaxScaler

plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
font = {'family': 'SimSun',
        'weight': 'normal',
        'size': 10,
        }


def helper(data, title):
    DAY_NUM = 26
    # in_card_data_train, in_card_data_test = util.get_train_test_dataset("./data/首都国际机场-in-card.csv")
    # DAY_NUM = 31

    data = list(data)

    # 计算前11天客流平均值
    sums = np.zeros(100)
    data = np.array(data).reshape(DAY_NUM, -1)
    for one_day_data in data:
        sums = sums + one_day_data
    average = sums / (DAY_NUM)
    oneday = data[-100:]

    plt.plot(oneday, label='20191217客流')
    plt.plot(average, label='平均客流',linestyle='--')
    plt.legend()  # 显示图例
    plt.title(title, font)
    plt.xlabel("时序", font)
    plt.ylabel("客流量", font)
    plt.show()


def temp(begin, end, n):
    for i in range(n):
        print(i)
if __name__ == '__main__':




    # abs = __file__[:-7]
    # abs = abs + "data/2019allday.csv"
    # multi_dataset = pandas.read_csv(abs, header=0, index_col=0)
    # day_num = 26  # 数据包含的天数
    # # multi_dataset = read_csv('./data/多源数据总表.csv', header=0, index_col=None)
    # # day_num = 31  # 数据包含的天数
    # # 取in_card_flow(流出机场客流)、实际降落载客数 arr_ALDT_passenger、时段、天气作为参数，预测in_card_flow
    # in_flow = multi_dataset['in_flow'].values[:103].tolist()
    # out_flow = multi_dataset['out_flow'].values[:103].tolist()
    # arr_true = multi_dataset['arr_ALDT_passenger'].values[:103].tolist()
    # dep_true = multi_dataset['dep_ATOT_passenger'].values[:103].tolist()
    # print("test3")


    # in_flow数据
    test_data = [21.0, 18.0, 26.0, 14.0, 13.0, 35.0, 14.999999046325684, 22.0, 23.0, 20.0, 25.0, 37.0, 17.0, 23.0, 24.0, 26.0, 25.0, 29.999998092651367, 19.0, 26.0, 25.0, 29.999998092651367, 29.999998092651367, 47.0, 29.999998092651367, 38.0, 44.0, 43.0, 38.0, 32.0, 29.000001907348633, 32.0, 28.0, 33.0, 33.0, 32.0, 31.0, 36.0, 39.0, 51.0, 34.0, 38.0, 32.0, 31.0, 27.0, 37.0, 36.0, 40.0, 36.0, 42.0, 39.0, 49.0, 59.999996185302734, 70.0, 65.0, 39.0, 37.0, 61.0, 45.0, 47.0, 50.0, 65.0, 40.0, 34.0, 41.0, 49.0, 65.0, 54.0, 68.0, 53.0, 62.0, 35.0, 34.0, 39.0, 56.0, 40.0, 26.0, 59.999996185302734, 43.0, 46.0, 51.0, 53.0, 49.0, 33.0, 42.0, 26.0, 14.999999046325684, 37.0, 21.0, 16.0, 29.999998092651367, 13.0, 2.0, 2.0]
    arima = [19.393118589089628, 19.199650544014442, 18.732037995729144, 22.52272250999832, 18.039142654241218, 16.53620433875179, 25.906968456578035, 18.518736523258358, 21.39554622688801, 21.69091146023146, 20.665966768666095, 23.790396600112427, 28.7572140513738, 22.013205810443637, 23.910115113321535, 24.13228299730058, 25.08991138246356, 25.20276522680214, 26.56099857006506, 22.76727222663724, 25.239616358336068, 25.015858174274815, 27.186837254935284, 28.142046200729954, 36.239401265277806, 31.731929745078244, 35.471440374270884, 39.55856416080894, 40.33091109606416, 39.65220557650866, 35.820673045362746, 33.916560029698765, 34.02532346648948, 31.099879199929266, 32.08003705993142, 31.902880397337633, 31.59424363217012, 31.4857290587967, 33.59353336099393, 35.894155011963136, 42.404265867666176, 36.89659644431363, 38.45827095983601, 36.022640975417836, 34.46224091065211, 31.895451892072458, 34.11373622562698, 34.3676270712429, 36.34348094132813, 35.631168113949734, 38.648391957694336, 38.7986052254011, 43.576737124229716, 50.50611353234032, 57.820323116753954, 59.648951079837126, 49.5581805550939, 46.99285579055743, 55.93266478994998, 49.16063470688, 48.32793877607923, 48.32660940602629, 55.860292515986174, 47.697120497090026, 42.33084211358789, 43.69943123647, 46.23855299949953, 54.607832223720564, 50.914624443878225, 58.84650370440065, 55.311548348767836, 59.7439439003157, 48.60451516956921, 43.757059638975846, 43.78032652740748, 48.769597956948594, 43.01210784664083, 34.42085945647079, 48.67550197817977, 43.557377532199176, 45.504830301932, 47.660466103999504, 48.98729708383447, 50.00735739043931, 41.51748313529026, 43.80941223613171, 35.679627148708896, 27.416080863747823, 33.79167916046584, 25.53846860805727, 22.0742618183029, 26.28008470723589, 18.51545305740902, 12.853612153177703]
    lstm = [23.249998092651367, 22.80785369873047, 21.792844772338867, 23.594518661499023, 23.152862548828125, 21.15941047668457, 25.487619400024414, 24.873458862304688, 25.114883422851562, 25.871850967407227, 28.874481201171875, 29.93808364868164, 32.84153747558594, 31.07465934753418, 30.691425323486328, 30.83853530883789, 32.75529861450195, 34.2668342590332, 35.12559127807617, 34.14799880981445, 35.37217330932617, 35.786258697509766, 36.40186309814453, 37.64271926879883, 42.09229278564453, 41.79816818237305, 42.52632522583008, 44.70521545410156, 45.5655403137207, 45.80610275268555, 44.010826110839844, 42.331233978271484, 40.1634521484375, 38.68094253540039, 39.98107147216797, 40.69389724731445, 41.145511627197266, 42.392765045166016, 40.711612701416016, 42.08290481567383, 46.561729431152344, 44.516822814941406, 44.382442474365234, 43.445858001708984, 43.3109016418457, 42.20484924316406, 43.70587158203125, 43.692848205566406, 44.743614196777344, 43.505943298339844, 44.71501922607422, 46.65147399902344, 48.23710632324219, 51.5692138671875, 55.42589569091797, 57.660430908203125, 53.939781188964844, 51.315528869628906, 53.86906814575195, 51.864540100097656, 49.326393127441406, 48.79914855957031, 50.65353775024414, 48.3364372253418, 44.464900970458984, 46.74760818481445, 48.96617126464844, 53.26286315917969, 50.96102523803711, 56.595733642578125, 54.680641174316406, 55.92421340942383, 50.58430480957031, 45.15007019042969, 42.466514587402344, 46.23851013183594, 44.06980514526367, 38.32853698730469, 43.825889587402344, 43.52683639526367, 43.796226501464844, 45.625125885009766, 49.22227096557617, 48.736724853515625, 43.09833526611328, 42.33188247680664, 35.71196746826172, 28.730737686157227, 30.266733169555664, 25.840381622314453, 23.471521377563477, 23.54391860961914, 19.403141021728516, 13.46706485748291]
    lstm_att = [18.34418507,18.09341116,18.48178806,19.79514923,18.04131145,16.95845575,21.17317734,19.49656067,20.52686882,21.18898144,22.26763325,24.41693687,27.34068661,25.24055367,25.36647072,24.87926216,26.07689991,28.0507309,28.98137856,28.184165,29.13857574,29.73531723,30.11064301,31.95373306,36.83684235,37.60630417,38.80534897,40.25812492,40.8323101,41.37045364,39.73816299,37.18478584,35.45262527,33.08469276,33.44303627,34.37788162,34.85930634,35.53331261,34.21595078,35.59417992,39.55634995,38.59642029,38.93079262,37.61854935,37.78649483,36.29462318,37.08746338,38.10189285,38.45814209,36.41309509,37.57134438,39.49052544,41.00571556,45.03329353,49.76198769,52.17332077,49.9554615,48.05737381,48.44822693,46.45299492,43.14796982,42.41854744,45.47380447,42.95636292,39.9391983,40.90342255,43.3143158,47.82289886,46.96854439,50.89460068,49.24147835,51.11552658,46.59041824,40.90836945,38.93641777,41.01442719,39.34336166,33.9061203,39.17318001,39.32158966,40.98495216,42.0228138,43.28211899,44.10446167,38.59084892,37.22034454,33.31229,27.45470085,27.11314945,24.05307961,22.98272457,23.3274456,20.76907787,15.54912844]
    # bilstm = [20.984548568725586, 20.66792106628418, 20.035533905029297, 22.55193519592285, 20.296140670776367, 18.22516441345215, 24.58936882019043, 20.833614349365234, 22.472576141357422, 22.756593704223633, 24.383991241455078, 26.29930305480957, 29.258974075317383, 25.331972122192383, 26.36538314819336, 26.372323989868164, 28.3797607421875, 29.7196044921875, 30.565696716308594, 28.67613410949707, 30.447551727294922, 31.110124588012695, 32.65450668334961, 33.98065948486328, 39.741615295410156, 37.02217483520508, 39.39875030517578, 42.28145217895508, 42.43503189086914, 41.787940979003906, 39.224815368652344, 37.04153060913086, 36.39140701293945, 34.61497116088867, 35.49583435058594, 35.90753936767578, 35.732967376708984, 36.229576110839844, 36.123477935791016, 37.41786193847656, 42.88834762573242, 38.728370666503906, 39.55299758911133, 38.52116775512695, 38.84269714355469, 36.71900177001953, 38.534080505371094, 38.741539001464844, 39.50383758544922, 37.812721252441406, 39.93779754638672, 40.53199005126953, 43.087100982666016, 48.952392578125, 53.27375030517578, 54.587913513183594, 47.04404067993164, 45.905609130859375, 52.29021072387695, 47.06711196899414, 44.83546447753906, 44.6629524230957, 49.83735275268555, 44.01735305786133, 40.68532943725586, 42.9338264465332, 45.91911697387695, 52.02821350097656, 48.66660690307617, 54.9055061340332, 49.632869720458984, 53.960628509521484, 45.13169860839844, 41.45261001586914, 40.86341857910156, 44.956878662109375, 40.52766799926758, 33.62275314331055, 44.007511138916016, 41.593021392822266, 43.2521858215332, 44.281803131103516, 45.920799255371094, 46.54859924316406, 38.51604461669922, 39.62818145751953, 32.96562194824219, 25.588207244873047, 29.093372344970703, 22.868974685668945, 20.8558349609375, 23.37188148498535, 18.37578773498535, 11.937455177307129]
    # my_method = [23.08718490600586, 23.720048904418945, 23.287076950073242, 23.367504119873047, 22.014610290527344, 21.888429641723633, 23.774730682373047, 24.51421546936035, 25.363548278808594, 24.833757400512695, 26.426755905151367, 28.964885711669922, 32.68347930908203, 30.675907135009766, 30.178598403930664, 29.7965087890625, 30.996706008911133, 33.338897705078125, 33.98777389526367, 33.62562942504883, 34.55692672729492, 34.850181579589844, 34.06369400024414, 34.63603210449219, 39.59025955200195, 42.02987289428711, 41.86027908325195, 41.55487823486328, 43.635013580322266, 44.59620666503906, 43.666969299316406, 41.61360549926758, 40.165565490722656, 36.966033935546875, 37.4990234375, 40.318931579589844, 41.60639190673828, 42.13154602050781, 41.251747131347656, 41.57374572753906, 44.96897506713867, 46.4510383605957, 44.044044494628906, 42.544124603271484, 42.422386169433594, 41.60095977783203, 44.68421936035156, 47.28513717651367, 45.64381408691406, 44.0997314453125, 44.83582305908203, 46.782344818115234, 50.031375885009766, 50.540836334228516, 53.489227294921875, 54.791629791259766, 54.816734313964844, 50.44105911254883, 51.62094497680664, 52.30466079711914, 49.686283111572266, 49.90092086791992, 50.327110290527344, 44.51111602783203, 41.122840881347656, 43.56895065307617, 48.46410369873047, 54.57683563232422, 51.1525993347168, 52.50706481933594, 54.99092102050781, 53.74267578125, 47.323787689208984, 41.69076156616211, 42.355430603027344, 44.58622741699219, 42.56039047241211, 37.979637145996094, 40.38808059692383, 42.03707504272461, 41.05830001831055, 41.06865692138672, 46.96495056152344, 48.040740966796875, 40.47217559814453, 38.093780517578125, 35.377986907958984, 23.11525535583496, 20.813405990600586, 21.617515563964844, 17.730426788330078, 17.699607849121094, 15.831260681152344, 7.441269874572754]
    mse = mean_squared_error(test_data, lstm_att)
    mae = mean_absolute_error(test_data, lstm_att)
    r2 = r2_score(test_data, lstm_att)
    print(mse)
    print(mae)
    print(r2)
    fig, ax = plt.subplots(1, 1, figsize=(9, 6))
    ax.plot(test_data, label='实际值')
    ax.plot(arima, label='ARIMA')
    ax.plot(lstm, label='LSTM')
    ax.plot(lstm_att, label='time-featureATT')
    ax.legend()  # 显示图例
    ax.set_xlabel("时序", font)
    ax.set_ylabel("客流量", font)
    sns.despine()  # 去掉右框线和上框线
    plt.show()


    # out_flow数据
    test_data = [56.0, 4.0, 51.0, 50.0, 40.999996185302734, 55.000003814697266, 5.0, 33.0, 46.0, 50.0, 26.0, 44.0, 47.0, 46.0, 34.0, 12.000000953674316, 51.0, 40.999996185302734, 36.0, 35.0, 30.0, 20.0, 39.0, 37.0, 30.0, 32.0, 26.0, 31.0, 40.999996185302734, 39.0, 52.0, 33.0, 25.0, 33.0, 55.000003814697266, 35.0, 24.000001907348633, 9.0, 33.0, 32.0, 38.0, 30.0, 33.0, 35.0, 35.0, 22.0, 33.0, 17.0, 30.0, 26.0, 20.0, 28.0, 34.0, 21.000001907348633, 29.0, 40.999996185302734, 26.999998092651367, 34.0, 22.0, 40.0, 52.0, 37.0, 25.0, 40.0, 44.0, 39.0, 38.0, 51.0, 22.0, 57.0, 48.000003814697266, 28.0, 30.0, 34.0, 24.000001907348633, 28.0, 25.0, 29.0, 19.0, 17.0, 17.0, 13.0, 23.0, 19.0, 20.0, 12.000000953674316, 17.0, 11.0, 16.0, 16.0, 14.0, 13.0, 7.0, 7.0]
    arima = [40.6449053627755, 36.77257471739158, 24.293410993586544, 49.5250962091729, 48.2077764165436, 32.51947267777153, 50.25744137857309, 25.123497250192795, 40.48413307218522, 45.3391346617855, 33.85009698357391, 31.06096205065535, 40.717609567725994, 44.71653729648358, 39.759456788336564, 39.19334984906916, 29.452927416342114, 47.199330635538296, 37.114370242064965, 30.46736760547506, 38.81504001229423, 33.78147183205343, 30.732575376745746, 37.013377895031965, 33.032375675327266, 28.04842172840297, 33.58518493937644, 30.122746323303467, 31.972824296785443, 35.71126139959546, 32.80748229231377, 40.70421452221082, 35.11447446158443, 33.43865310958091, 40.20753472405098, 43.81770858168399, 33.02041274412227, 30.40330182738449, 28.930984434783813, 34.57432822554159, 29.86580391315868, 27.110203017559154, 28.95518719885138, 30.800168319401884, 35.10232581845073, 33.15475538948216, 28.60924089160028, 33.560618021757286, 25.838938327096223, 28.60829519934816, 27.974285402365325, 20.975872400614183, 28.15678550600241, 28.350725038918505, 22.41201415027739, 28.194491778448345, 34.146803859014355, 25.771677988073538, 32.10924634848385, 28.753905284574373, 34.45577979399734, 40.89711363572745, 31.252712499611555, 32.633090962218915, 41.87511777195313, 40.343887859095254, 35.72022906564934, 38.09352455552435, 44.51812351383588, 31.90845734862136, 48.05762516545076, 45.04325620875889, 31.19787388399649, 41.541147394975724, 38.41410535119382, 30.670427441313457, 31.10110294953192, 28.353460591050176, 27.79454746412466, 24.097587591387125, 22.010782580110988, 22.561410403216676, 17.503431155115635, 20.885517631210224, 17.638780228883256, 17.525391097301707, 16.554840443548244, 17.929977223870402, 15.590952301164554, 15.39416017590608, 15.92924470023804, 13.207400160747664, 14.402956949702135, 11.416023718207889]
    lstm = [47.017574310302734, 48.137779235839844, 36.526039123535156, 44.09009552001953, 47.30020523071289, 47.28899002075195, 49.497337341308594, 38.13671112060547, 43.992149353027344, 44.01030349731445, 42.34896469116211, 39.37738800048828, 42.0440673828125, 46.43193054199219, 45.763282775878906, 43.04837417602539, 33.09534454345703, 43.418094635009766, 43.248695373535156, 40.74095153808594, 39.13999938964844, 36.658294677734375, 34.4194450378418, 35.2702751159668, 36.743778228759766, 37.53363037109375, 36.148826599121094, 32.39817810058594, 35.11777877807617, 38.35391616821289, 37.86342239379883, 44.80279541015625, 40.3995361328125, 39.973121643066406, 42.610172271728516, 42.92460250854492, 39.900489807128906, 35.488101959228516, 30.109317779541016, 38.29912567138672, 37.90869903564453, 35.74056625366211, 33.74388122558594, 33.404090881347656, 37.921451568603516, 39.023685455322266, 34.7183837890625, 35.30727767944336, 34.43992614746094, 36.177154541015625, 32.78133010864258, 28.751623153686523, 31.78748321533203, 32.548397064208984, 30.657812118530273, 31.530479431152344, 37.35930633544922, 32.91204071044922, 34.284141540527344, 31.52506446838379, 36.566532135009766, 39.299774169921875, 33.06583786010742, 36.70790481567383, 39.25507736206055, 44.57661819458008, 40.66909408569336, 35.28666687011719, 39.815006256103516, 34.45748519897461, 46.742984771728516, 41.95750045776367, 38.154205322265625, 34.30861282348633, 32.590965270996094, 37.853904724121094, 35.395328521728516, 28.62864112854004, 30.713212966918945, 24.544675827026367, 21.068132400512695, 25.023704528808594, 25.471328735351562, 24.70911407470703, 21.248687744140625, 19.219308853149414, 13.227459907531738, 15.043739318847656, 23.621801376342773, 23.823219299316406, 23.447702407836914, 18.262277603149414, 15.509160041809082, 16.580951690673828]
    lstm_att = [46.15259323,46.44189529,45.37258224,44.18554688,49.39808311,48.25935707,47.86938782,41.26117935,43.43505554,43.10127831,41.52189369,40.75954514,38.6821991,42.65149918,43.58601112,42.64509277,37.88813858,41.2456665,41.014505,38.74667702,37.87900009,37.31889076,37.81613731,35.93153458,35.89915314,36.48642311,35.87106094,35.03231468,35.48283577,37.08265114,36.96712799,40.24477501,39.7138401,38.23605537,39.20525589,40.16971664,40.48230591,37.1533432,34.5099884,36.08169174,36.86484985,34.30046787,33.8036747,33.82084999,36.20129623,36.54069862,35.25843391,33.95806675,33.13967495,33.44943161,31.51315536,29.64911079,31.14429283,31.3886488,31.36035519,30.47744637,32.68876495,33.35161705,32.58131237,31.08649769,33.77837906,38.00533905,35.64045906,36.0699028,35.92709846,38.29235725,37.96045952,35.66563911,37.58603439,36.35742035,40.57565842,40.77905045,39.17454796,37.90714836,35.30629883,36.16167603,31.93752346,29.20106544,28.65525074,26.61897049,25.45571899,24.90745811,22.70320549,22.53241024,20.49871311,19.9089035,20.12518349,20.55563774,19.51727715,18.4231905,17.77119713,15.0582366,14.89422369,14.96238031]
    # bilstm = [44.568485260009766, 44.800941467285156, 29.212038040161133, 44.789283752441406, 46.05117416381836, 42.59004211425781, 47.26405334472656, 29.827157974243164, 42.44447326660156, 42.739646911621094, 41.89828872680664, 34.88939666748047, 39.687381744384766, 44.03314208984375, 44.71031188964844, 41.07115173339844, 32.67967224121094, 46.62278747558594, 40.165401458740234, 38.69725799560547, 38.183998107910156, 36.370750427246094, 35.54523468017578, 38.29340744018555, 36.95500183105469, 36.01994323730469, 36.50288772583008, 34.388607025146484, 36.06086730957031, 39.4492073059082, 37.37110137939453, 44.41460037231445, 37.447872161865234, 36.402381896972656, 39.59955978393555, 44.905086517333984, 38.16921615600586, 35.025360107421875, 29.920574188232422, 37.412105560302734, 35.722198486328125, 35.33918380737305, 32.73786926269531, 34.09386444091797, 37.20241928100586, 37.36997604370117, 33.43046951293945, 35.24115753173828, 31.223485946655273, 34.76410675048828, 31.421497344970703, 29.366634368896484, 32.46114730834961, 32.46864318847656, 30.401899337768555, 32.06232452392578, 35.97003173828125, 32.040767669677734, 34.44978713989258, 30.3391170501709, 36.78618621826172, 41.032833099365234, 34.58976745605469, 34.26674270629883, 37.474830627441406, 40.721923828125, 38.940189361572266, 36.8690185546875, 41.35923385620117, 33.49131774902344, 47.96669006347656, 41.22917938232422, 36.724945068359375, 37.340885162353516, 34.92646408081055, 34.52975082397461, 33.00810241699219, 29.724956512451172, 30.70431900024414, 27.400531768798828, 25.953353881835938, 26.071012496948242, 24.736331939697266, 26.128040313720703, 24.487367630004883, 24.353872299194336, 22.872108459472656, 23.846572875976562, 23.102680206298828, 23.591726303100586, 23.449018478393555, 21.952749252319336, 21.629940032958984, 20.986961364746094]
    # my_method = [40.399383544921875, 42.86119079589844, 37.70783615112305, 41.70014190673828, 44.85024642944336, 43.39983367919922, 43.3923454284668, 38.57516860961914, 44.10044860839844, 44.29757308959961, 37.84654235839844, 35.082847595214844, 40.30591583251953, 43.24131774902344, 44.329891204833984, 44.141571044921875, 35.974891662597656, 39.44771957397461, 38.73521423339844, 34.694087982177734, 36.47441101074219, 37.73930740356445, 33.594058990478516, 33.037662506103516, 33.47560119628906, 33.77677536010742, 34.07175064086914, 33.16764450073242, 33.375144958496094, 34.59213638305664, 35.36537551879883, 38.37086486816406, 37.857330322265625, 39.46588134765625, 39.197147369384766, 39.01492691040039, 36.3388557434082, 34.30366516113281, 32.03981399536133, 35.793216705322266, 33.08454895019531, 32.21399688720703, 30.342533111572266, 30.14897918701172, 35.96359634399414, 37.26612091064453, 33.18896484375, 34.41530227661133, 32.414031982421875, 29.95220375061035, 30.078922271728516, 28.528034210205078, 28.639930725097656, 32.09551239013672, 30.628755569458008, 28.466123580932617, 33.615638732910156, 33.69033432006836, 30.001726150512695, 31.66840934753418, 34.728328704833984, 35.12437438964844, 33.14678192138672, 32.65752410888672, 37.18155288696289, 40.84934616088867, 36.92579650878906, 36.069976806640625, 39.731571197509766, 34.856021881103516, 39.49473190307617, 40.84224319458008, 39.26067352294922, 34.683834075927734, 35.71369552612305, 34.18379592895508, 29.788480758666992, 29.639806747436523, 28.74175262451172, 23.695276260375977, 24.564706802368164, 24.662105560302734, 22.510099411010742, 20.59027671813965, 19.07513999938965, 14.78829574584961, 15.82721996307373, 19.490720748901367, 17.975486755371094, 19.737281799316406, 17.92991828918457, 14.911055564880371, 14.510560989379883, 13.613155364990234]
    # mse = mean_squared_error(test_data, lstm_att)
    # mae = mean_absolute_error(test_data, lstm_att)
    # r2 = r2_score(test_data, lstm_att)
    # print(mse)
    # print(mae)
    # print(r2)
    # fig, ax = plt.subplots(1, 1, figsize=(9, 6))
    # ax.plot(test_data, label='实际值')
    # ax.plot(arima, label='ARIMA')
    # ax.plot(lstm, label='LSTM')
    # ax.plot(lstm_att, label='time-featureATT')
    # ax.legend()  # 显示图例
    # ax.set_xlabel("时序", font)
    # ax.set_ylabel("客流量", font)
    # sns.despine()  # 去掉右框线和上框线
    # plt.show()

    # 相关性分析
    # multi_dataset = read_csv('./data/2019allday.csv', header=0, index_col=0)
    # day_num = 26  # 数据包含的天数
    # # multi_dataset = read_csv('./data/多源数据总表.csv', header=0, index_col=None)
    # # day_num = 31  # 数据包含的天数
    #
    # dataset = DataFrame()
    # # 取in_card_flow(流出机场客流)、实际降落载客数 arr_ALDT_passenger、时段、天气作为参数，预测in_card_flow
    # dataset['in_flow'] = multi_dataset['in_flow']
    # dataset['out_flow'] = multi_dataset['out_flow']
    # # dataset['arr_ALDT_passenger'] = multi_dataset['arr_ALDT_passenger']
    # # dataset['arr_SIBT_passenger'] = multi_dataset['arr_SIBT_passenger']
    # # dataset['dep_ATOT_passenger'] = multi_dataset['dep_ATOT_passenger']
    # # dataset['dep_SOBT_passenger'] = multi_dataset['dep_SOBT_passenger']
    # #
    # # dataset['hour'] = multi_dataset['hour']
    # dataset['weather'] = multi_dataset['weather']
    # dataset['workday'] = multi_dataset['workday']
    #
    # in_flow = dataset['in_flow'].tolist()
    # out_flow = dataset['out_flow'].tolist()
    # workday = dataset['workday'].tolist()  # 0是休息，1是工作日
    # work_in = np.zeros(2)
    # work_out = np.zeros(2)
    # # for i in range(2600):
    # #     j = i % 100
    # #     if j >= 0 and j < 3:
    # #         hours_in[0] = hours_in[0] + in_flow[i]
    # #         hours_out[0] = hours_out[0] + out_flow[i]
    # #     if j >= 3 and j < 9:
    # #         hours_in[1] = hours_in[1] + in_flow[i]
    # #         hours_out[1] = hours_out[1] + out_flow[i]
    # #     if j >= 9 and j < 15:
    # #         hours_in[2] = hours_in[2] + in_flow[i]
    # #         hours_out[2] = hours_out[2] + out_flow[i]
    # #     if j >= 15 and j < 21:
    # #         hours_in[3] = hours_in[3] + in_flow[i]
    # #         hours_out[3] = hours_out[3] + out_flow[i]
    # #     if j >= 21 and j < 27:
    # #         hours_in[4] = hours_in[4] + in_flow[i]
    # #         hours_out[4] = hours_out[4] + out_flow[i]
    # #     if j >= 27 and j < 33:
    # #         hours_in[5] = hours_in[5] + in_flow[i]
    # #         hours_out[5] = hours_out[5] + out_flow[i]
    # #     if j >= 33 and j < 39:
    # #         hours_in[6] = hours_in[6] + in_flow[i]
    # #         hours_out[6] = hours_out[6] + out_flow[i]
    # #     if j >= 39 and j < 45:
    # #         hours_in[7] = hours_in[7] + in_flow[i]
    # #         hours_out[7] = hours_out[7] + out_flow[i]
    # #     if j >= 45 and j < 51:
    # #         hours_in[8] = hours_in[8] + in_flow[i]
    # #         hours_out[8] = hours_out[8] + out_flow[i]
    # #     if j >= 51 and j < 57:
    # #         hours_in[9] = hours_in[9] + in_flow[i]
    # #         hours_out[9] = hours_out[9] + out_flow[i]
    # #     if j >= 57 and j < 63:
    # #         hours_in[10] = hours_in[10] + in_flow[i]
    # #         hours_out[10] = hours_out[10] + out_flow[i]
    # #     if j >= 63 and j < 69:
    # #         hours_in[11] = hours_in[11] + in_flow[i]
    # #         hours_out[11] = hours_out[11] + out_flow[i]
    # #     if j >= 69 and j < 75:
    # #         hours_in[12] = hours_in[12] + in_flow[i]
    # #         hours_out[12] = hours_out[12] + out_flow[i]
    # #     if j >= 75 and j < 81:
    # #         hours_in[13] = hours_in[13] + in_flow[i]
    # #         hours_out[13] = hours_out[13] + out_flow[i]
    # #     if j >= 81 and j < 87:
    # #         hours_in[14] = hours_in[14] + in_flow[i]
    # #         hours_out[14] = hours_out[14] + out_flow[i]
    # #     if j >= 87 and j < 93:
    # #         hours_in[15] = hours_in[15] + in_flow[i]
    # #         hours_out[15] = hours_out[15] + out_flow[i]
    # #     if j >= 93 and j < 99:
    # #         hours_in[16] = hours_in[16] + in_flow[i]
    # #         hours_out[16] = hours_out[16] + out_flow[i]
    # #     if j >= 99:
    # #         hours_in[17] = hours_in[17] + in_flow[i]
    # #         hours_out[17] = hours_out[17] + out_flow[i]
    # for i in range(2600):
    #     if(workday[i] == 0):
    #         work_in[0] = work_in[0] + in_flow[i]
    #         work_out[0] = work_out[0] + out_flow[i]
    #     elif(workday[i] == 1):
    #         work_in[1] = work_in[1] + in_flow[i]
    #         work_out[1] = work_out[1] + out_flow[i]
    #
    # print(work_in)
    # print(work_out)
    #
    # # X = ('6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18',
    # #           '19', '20', '21', '22', '23')
    # #
    # #


    #
